package com.crud.service.impl;

import com.crud.bean.Employee;
import com.crud.dao.EmployeeDao;
import com.crud.dao.impl.EmployeeDaoImpl;
import com.crud.service.EmployeeService;

import java.util.List;

/**
 * @author wzm
 * @create 2023-05-08 10:26
 */
public class EmployeeServiceImpl implements EmployeeService {
    //调用dao实现功能
    private EmployeeDao employeeDao = new EmployeeDaoImpl();
    @Override
    public boolean add(Employee employee) {
        return employeeDao.insertEmployee(employee) > 0;
    }

    @Override
    public boolean remove(Employee employee) {
        return employeeDao.deleteEmployee(employee) > 0;
    }

    @Override
    public boolean modify(Employee employee) {
        return employeeDao.updateEmployee(employee) > 0;
    }

    @Override
    public Employee findById(Employee employee) {
        return employeeDao.selectById(employee);
    }

    @Override
    public List<Employee> findByAll() {
        return employeeDao.selectByList();
    }
}
